import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/core/ext/ext.dart';
import 'package:enterprise_v6_app/app/modules/application/education/personal_profile/personal_profile_controller.dart';

class EducationProfileCertController extends GetxController {
  final profile = Get.find<EducationProfileController>();
  
  final certUrls = <String>[];

  void onProfileChanged() {
    certUrls.clear();
    final urls = profile.entity?.documentUrl.split(',') ?? [];
    urls.removeWhere((element) => element.isBlankString);
    certUrls.addAll(urls);
    update();
  }

  void onSaveChanges() {
    profile.entity?.documentUrl = certUrls.join(',');
  }
}